<?php
/*------------------------------------------------------------------------
# company - company management
# @author    pipapai.com
-------------------------------------------------------------------------*/

defined('_JEXEC') or die;
// disable core styles to avoid bs conflict
OC_Util::$core_styles = array();

if(isDevMode()) {
   OCP\Util::addStyle('company', 'company');
   OCP\Util::addStyle('jobposition', 'jobposition');
} else {
   OCP\Util::addStyle('static', 'company');
   OCP\Util::addStyle('static', 'jobposition');
}

$lang = PFactory::getLanguage();
$lang->load("com_jobs", JPATH_SITE, "zh-CN");

$user = $_['user'];
$error_msg = $_['error_msg'];
$job_detail = $_['jobdetail'];

UserPrivacy::getUserPrivacySettings($user, 'com_company'); 
$me = PFactory::getUser();
?>

<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkTo('company/js', 'company.php'));?>"></script>
<?php if(!empty($error_msg)):?>
<?php echo $error_msg;?>
<?php else:?>
<?php if(!empty($user)):?>
<div class="row-fluid">
   <div class="span12">
      <div class="com_box com_box_top">
         <div class="clearfix">
            <div class="company_infomodel pull-left">
               <div class="view_companymessage medium clearfix"><img src="<? echo PCompanyHelper::showCompanyAvatar($user->avatar, $user->avatarapproved);?>"/><br/><br/></div>
            </div>
            
            <div style=" margin-left:160px;">
               <div class="company_showinfo">
                  <h4 class="yahei"><?=$user->comp_name?></h4>
               </div>
      
               <div class="company_viewcombox">
                  <h6 class="yahei large">公司信息</h6>
                  <div class="company_viewbasic">
                     <table class="medium clearfix" width="100%" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                           <td>公司行业：<?php echo !empty($user->industry) ? JText::_($user->industry) : '暂无'?></td>
                           <td>公司性质：<?php echo !empty($user->comp_type) ? JText::_($user->comp_type) : '暂无'?></td>
                        </tr>
                        <tr>
                           <td>所在地区：<?php echo (!empty($user->state) || !empty($user->city)) ? ($user->state == $user->city ? $user->state : $user->state.' '.$user->city) : ''; ?></td>
                           <td>公司规模：<?php echo  !empty($user->size_type) ? $user->size_type : '暂无'?></td>
                        </tr>
                        <tr>
                        <?php 
                           $phonefieldname = "contactname"; 
                           $phoneprivacy = UserPrivacy::checkFieldPrivacy($user, $me, $phonefieldname); 
                           if($phoneprivacy){
                              $phoneprivacy_value=UserPrivacy::getUserPrivacyFieldSetting($user,$phonefieldname); 
                              if($phoneprivacy_value->privacy==USER_PRIVACY_PUBLIC){
                        ?>
                           <td>联&nbsp;&nbsp;系&nbsp;&nbsp;人：<?php echo !empty($user->contact_name) ? $user->contact_name : '暂无'?></td>
                        <?php }
                           }
                         ?>


                        <?php 
                           $phonefieldname = "telephone"; 
                           $phoneprivacy = UserPrivacy::checkFieldPrivacy($user, $me, $phonefieldname);  
                           if($phoneprivacy){  
                              $phoneprivacy_value=UserPrivacy::getUserPrivacyFieldSetting($user,$phonefieldname);  
                              if($phoneprivacy_value->privacy==USER_PRIVACY_PUBLIC){ 
                        ?>
                           <td>联系电话：<?php echo !empty($user->phone) ? $user->phone : '暂无'?></td>
                        <?php
                              } 
                           }
                        ?>   
                        </tr>
                        <tr>
                           <td colspan="2">公司地址：<?php echo !empty($user->address) ? $user->address : '暂无'?></td>
                        </tr>
                        <tr>
                           <td colspan="2">公司网址：<?php echo !empty($user->website) ? "<a href='".$user->website."' target='_blank'>".$user->website."</a>" : "暂无"?></td>
                        </tr>
                     </table>
                  </div>
               </div>
            </div>
         </div>

         <div class="company_viewcombox">
            <h6 class="yahei large">公司概况</h6>
            <div class="company_viewsummry medium">
               <?php echo !empty($user->summary) ? $user->summary : '暂无'?>
            </div>
         </div>
      </div>
   </div>
</div>
<?php endif;?>
<?php if(!empty($job_detail)):?>
<div class="row-fluid">
   <div class="span12">
      <div class="com_box">
         <div class="company_viewcombox" style="margin-top:0px;">
            <h6 class="yahei large"><?php echo !empty($job_detail->job_title) ? $job_detail->job_title:'';?>职位概况</h6>
            <div class="company_viewsummry medium">
               <div class="set_quence_content">
               	  <div class="form-horizontal medium clearfix" style="padding-top:0px; margin-left:0px;">
                    <div class="control-group">
                      <label for="" class="control-label key bfy" data-original-title="">工作城市:</label>
                      <div class="controls">
                        <span>
                        <?php echo (!empty($job_detail->state) || !empty($job_detail->city)) ? ($job_detail->state == $job_detail->city ? $job_detail->state : $job_detail->state.' '.$job_detail->city) : '不限'; ?>
                        </span>
                      </div>
                    </div>
                    <div class="control-group">
                      <label for="" class="control-label key bfy" data-original-title="">工作职能:</label>
                      <div class="controls">
                        <span><?php echo !empty($job_detail->pos_txt) ? $job_detail->pos_txt : '未设置' ; ?></span>
                      </div>
                    </div>
                    <div class="control-group">
                      <label for="" class="control-label key bfy" data-original-title="">工作经验:</label>
                      <div class="controls">
                        <span><?php echo !empty($job_detail->exp_name) ? JText::_($job_detail->exp_name) : '不限' ; ?></span>
                      </div>
                    </div>
                    <div class="control-group">
                      <label for="" class="control-label key bfy" data-original-title="">月薪范围:</label>
                      <div class="controls">
                        <span><?php echo !empty($job_detail->salary_type) ? JText::_($job_detail->salary_type) : '面议' ; ?></span>
                      </div>
                    </div>
                    <div class="control-group">
                      <label for="city" class="control-label key bfy" data-original-title="">招聘人数:</label>
                      <div class="controls">
                        <span><?php echo !empty($job_detail->num_needed) ? $job_detail->num_needed :'若干'; ?></span>
                      </div>
                    </div>
                  </div>
                  
                  <div class="hr_position_description medium" style="padding-left:7px;">
                  <?php echo !empty($job_detail->long_desc) ? htmlspecialchars_decode(nl2br($job_detail->long_desc)) : '暂无'?>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
</div>
<?php endif;?>
<?php endif;?>